package pikes.peak;

import java.util.HashMap;

import org.junit.Test;
import pikes.html.xhtml.Block;
import pikes.html.xhtml.heading.H1;
import pikes.html.xhtml.text.phrase.Strong;
import pikes.peak.Label;
import pikes.peak.LabelStyle;
import pikes.peak.Paragraph;
import pikes.peak.TextGroupStyle;
import pikes.peak.test.AssertHtml;
import pikes.peak.test.PikesPeakComponentTestCase;

public class TextGroupTestCase extends PikesPeakComponentTestCase {

	@Test
	public void createSimpleParagraph() throws Exception {
		Paragraph textGroup = new Paragraph("Some text");

		Block expected = new pikes.html.xhtml.text.Paragraph("Translated Text");
		Block actual = textGroup.createHtml(new HashMap(), pikesPeakRequest.getRequestContext());
		AssertHtml.assertEquals(expected, actual);
	}

	@Test
	public void createSimpleParagraph1() throws Exception {
		Paragraph textGroup = new Paragraph();
		textGroup.add("Some text");

		Block expected = new pikes.html.xhtml.text.Paragraph("Translated Text");
		Block actual = textGroup.createHtml(new HashMap(), pikesPeakRequest.getRequestContext());
		AssertHtml.assertEquals(expected, actual);
	}

	@Test
	public void createHeader0() throws Exception {
		Paragraph textGroup = new Paragraph(TextGroupStyle.LEVEL_1);
		textGroup.add("Some text");

		Block expected = new H1("Translated Text");
		Block actual = textGroup.createHtml(new HashMap(), pikesPeakRequest.getRequestContext());
		AssertHtml.assertEquals(expected, actual);
	}

	@Test
	public void createHeader1() throws Exception {
		Paragraph textGroup = new Paragraph("Some text", TextGroupStyle.LEVEL_1);

		Block expected = new H1("Translated Text");
		Block actual = textGroup.createHtml(new HashMap(), pikesPeakRequest.getRequestContext());
		AssertHtml.assertEquals(expected, actual);
	}

	@Test
	public void createDecoratedTextinParagraph() throws Exception {
		Label label = new Label("Some text", LabelStyle.STRONG);
		Paragraph textGroup = new Paragraph(label);

		Block expected = new pikes.html.xhtml.text.Paragraph(new Strong("Translated Text"));
		Block actual = textGroup.createHtml(new HashMap(), pikesPeakRequest.getRequestContext());
		AssertHtml.assertEquals(expected, actual);
	}

}
